package com.hyt.it.ogt.pj.enums;


import lombok.Getter;

/**
 * 主观题类型枚举
 */
@Getter
public enum SubjectiveItemTypeEnum {

	short_answer("short_answer", "简答题"),
	picture_answer("picture_answer", "图片答案题"),
	fill_in_blanks("fill_in_blanks", "填空题"),
	compound("compound", "复合题");
	

    private final String code;
    private final String name;

    SubjectiveItemTypeEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    /**
     * 获取主观题类型
     * @param code 试卷类型标识
     * @return 试卷类型枚举值
     */
    public static SubjectiveItemTypeEnum getByCode(String code) {
        for (SubjectiveItemTypeEnum value : values()) {
            if (value.getCode().equals(code)) {
                return value;
            }
        }
        return null;
    }
    
    /**
     * 获取主观题描述
     * @param code 试卷类型标识
     * @return 试卷类型枚举值
     */
    public static String getNameByCode(String code) {
        for (SubjectiveItemTypeEnum value : values()) {
            if (value.getCode().equals(code)) {
                return value.getName();
            }
        }
        return null;
    }

}
